﻿using Client.Constant;
using Client.Framework.Message;
using Client.Model;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;

namespace Client.Message.Response
{
    [MessageAttr(MessageId.RESPONSE_ORG_TREE)]
    class OrgTreeResp : ResponseBaseMessage
    {

        public List<ViewOrg> OrgList { get; } = new List<ViewOrg>();

        public int HasRoot { get; set; }

        public override void Deserialize(byte[] buffer)
        {
            ResponseOrgTree msg = ResponseOrgTree.Parser.ParseFrom(buffer);
            foreach (var org in msg.Orgs)
            {
                OrgList.Add(new ViewOrg()
                {
                    ID = org.Id,
                    ParentId = org.ParentId,
                    OrgName = org.OrgName
                });
            }
        }


        



    }
}
